﻿using System.Collections.Generic;
using System.Data;
using MyFloridaHouse.DataAccess.Extensions;
using MyFloridaHouse.libSvDTO;
using System.Data.SqlClient;
using Microsoft.SqlServer.Types;

namespace MyFloridaHouse.DataAccess
{
    public partial class DAL_CensusData
    {
        /// <summary>
        /// Gets the district plan types.
        /// </summary>
        /// <returns>List of <see cref="DistrictPlanTypeDTO"/></returns>
        /// <remarks>SPROC: usp_GetDistrictPlanTypes</remarks>
        public List<DistrictPlanTypeDTO> GetDistrictPlanTypes()
        {
            List<DistrictPlanTypeDTO> itemList = new List<DistrictPlanTypeDTO>();

            //string storedProcedureName = "usp_GetDistrictPlanTypes";
            string storedProcedureName = "usp_tl10GetDistrictPlanTypes10";

            using (SqlConnection db = Connect())
            {
                SqlCommand StoredProcedureCommand = new SqlCommand(storedProcedureName, db);
                StoredProcedureCommand.CommandType = CommandType.StoredProcedure;

                db.Open();
                using (SqlDataReader rdr = StoredProcedureCommand.ExecuteReader())
                {
                    while (rdr.Read())
                    {
                        itemList.Add(DistrictPlanTypeDTODataContract.DataContract(rdr));
                    }
                }
            }

            return itemList;
        }
    }
}
